package logicaDePredicados;



public class PredicateVariable<T> extends PredicateLogic {
	private T value;
	public PredicateVariable (String name, T value){
		setName(name);
		this.value= value;
		
				
	}
	/**
	 * @return the value
	 */
	public T getValue() {
		return value;
	}
	/**
	 * @param object the value to set
	 */
	@SuppressWarnings("unchecked")
	public void setValue(Object object) {
		this.value = (T) object;
		
	}
	@Override 
	public PredicateVariable<T> clone(){
		return new PredicateVariable<T> (this.getName(),value);
	}

	@Override
	public boolean equals(Object o) { 
		
		if (o.getClass() == this.getClass()) { 
			PredicateVariable<?> p1 = (PredicateVariable<?>) o;
			return p1.getValue().equals(this.value)
			&& p1.getValue().equals(this.value);

		}

		return(false);
	}
	
	@Override
	public int hashCode() {
		int hash = 1;
	    hash = hash * 31 + value.hashCode();
	    
	    return hash;	 
	}
        @Override
        public String toString (){
            return getName();
        }
	
	
	
}
